from rest_framework.viewsets import ModelViewSet
from meiduo_admin.utils import MyPagination
from users.models import User
from django.contrib.auth.models import Group
from meiduo_admin.serializers.admin_serializer import UserSerializer, GroupSimpleSerializer


class AdminView(ModelViewSet):
    """ 运营用户 增删改查 """

    queryset = User.objects.filter(is_staff=True).order_by("id")
    serializer_class = UserSerializer
    pagination_class = MyPagination


class GroupSimpleView(ModelViewSet):
    """ 获取分组表数据 """

    queryset = Group.objects.all().order_by("id")
    serializer_class = GroupSimpleSerializer
    pagination_class = None

